home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / meter.cpp < prev    next >
C/C++ Source or Header  |  1994-10-10  |  2KB  |  54 lines

  1. #include "meter.h"
  2. #include "khbgi.h"
  3. #include "patterns.h"
  4.  
  5. void Meter::show_meter(rect r, int attr, int bak, uchar* pat)
  6.     {
  7.     bar(r, attr, bak, pat);
  8.     }
  9. /////////////////////////
  10. void Meter::show(loc pos, int len, int direction, int cursor, int pat,
  11.               BORDERS type)
  12.     {
  13.     loc corner = !direction ? loc(pos.X + len, pos.Y + 1)
  14.                            : loc(pos.X + 2, pos.Y + len);
  15.     rect r = screenRect(rect(pos, corner));
  16.  
  17.     r.corner -= loc(2, 2);
  18.     show_meter(r, (int)pColorSet->colors.ATTR_COLOR,
  19.         (int)pColorSet->colors.FILL_COLOR, (uchar*)::pattern[pat]);
  20.     r.corner += loc(2, 2);
  21.  
  22.     Carcase c;
  23.     c.show(type, r);
  24.  
  25.     rect curs = !direction ? rect(pos.X + cursor, pos.Y,
  26.                                  pos.X + cursor + 2, pos.Y + 1)
  27.                           : rect(pos.X, pos.Y + cursor,
  28.                      pos.X + 2, pos.Y + cursor + 1);
  29.     rect r1 = screenRect(curs);
  30.     r1.symmexpand(loc(-1, -1));
  31.     Element e(r1, NO_ELEMENT, BUTTON_BORDER, pat, 1);
  32.     e.show();
  33.     }
  34. ////////////////////////
  35. /*
  36. void main()
  37.     {
  38.     if(!init_KNOW_HOW())
  39.         return;
  40.     setfillstyle(SOLID_FILL, pColorSet->colors.BAK_COLOR);
  41.     bar(0, 0, getmaxx(), getmaxy());
  42.  
  43.     Meter m;
  44.     m.show(loc(10, 10), 40, 0, 11, 16, NO_BORDER);
  45.     m.show(loc(10, 12), 40, 0, 11, 16, BUTTON_BORDER);
  46.     m.show(loc(10, 14), 40, 0, 11, 16, SHOW_BORDER);
  47.     m.show(loc(60, 2), 20, 1, 11, 16, NO_BORDER);
  48.     m.show(loc(65, 2), 20, 1, 11, 16, BUTTON_BORDER);
  49.     m.show(loc(70, 2), 20, 1, 11, 16, SHOW_BORDER);
  50.  
  51.     close_KNOW_HOW();
  52.     closegraph();
  53.     }
  54. */